package com.night.icm.persistence.business.entity;

import com.night.icm.common.utils.TermType;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * StudentCourseGradeGather
 * 学生所有课程成绩，在后端汇总成list，按学期分
 * 学期平均绩点= { ∑（每一科绩点*每一科学分）}/该学期学分总和。
 *
 * @author Liao ZhiYong
 * @date 2020/2/2
 */
@Entity
@Getter
@Setter
@Table(name = "night_icm_student_course_grade_gather")
public class StudentCourseGradeGather {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /**
     * 年度，比如：2020年-2021年第一和第二学期都是2020年度的成绩
     */
    @Column(name = "year", nullable = false)
    private Integer year;

    /**
     * 第一或第二学期，也叫上学期和下学期
     */
    @Column(name = "term_type", nullable = false)
    @Enumerated(EnumType.STRING)
    private TermType termType;

    /**
     * 学院名称
     */
    @Column(name = "academy_name", length = 50, nullable = false)
    private String academyName;

    /**
     * 行政班级，如计算机163班
     */
    @Column(name = "class_name", length = 50, nullable = false)
    private String className;

    /**
     * 学期平均学分绩点
     */
    @Column(name = "average_credit_grade_point", nullable = false)
    private Double averageCreditGradePoint;

    /**
     * 学生学号
     */
    @Column(name = "student_code", length = 50, nullable = false)
    private String studentCode;

    /**
     * 学生姓名
     */
    @Column(name = "student_name", length = 50, nullable = false)
    private String studentName;

    @Override
    public boolean equals(Object o) {
        return super.equals(o);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}